//
//	ZcoModelScenariosEnable.m
//	Model file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport



#import "ZcoModelScenariosEnable.h"

NSString *const kZcoModelScenariosEnableIsRobot = @"isRobot";
NSString *const kZcoModelScenariosEnableScenarios = @"scenarios";

@interface ZcoModelScenariosEnable ()
@end
@implementation ZcoModelScenariosEnable




/**
 * Instantiate the instance using the passed dictionary values to set the properties values
 */

-(instancetype)initWithDictionary:(NSDictionary *)dictionary
{
	self = [super init];
	if(![dictionary[kZcoModelScenariosEnableIsRobot] isKindOfClass:[NSNull class]]){
		self.isRobot = [dictionary[kZcoModelScenariosEnableIsRobot] boolValue];
	}

	if(dictionary[kZcoModelScenariosEnableScenarios] != nil && [dictionary[kZcoModelScenariosEnableScenarios] isKindOfClass:[NSArray class]]){
		NSArray * scenariosDictionaries = dictionary[kZcoModelScenariosEnableScenarios];
		NSMutableArray * scenariosItems = [NSMutableArray array];
		for(NSDictionary * scenariosDictionary in scenariosDictionaries){
			ZcoModelScenarioBrief * scenariosItem = [[ZcoModelScenarioBrief alloc] initWithDictionary:scenariosDictionary];
			[scenariosItems addObject:scenariosItem];
		}
		self.scenarios = scenariosItems;
	}
	return self;
}


/**
 * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property
 */
-(NSDictionary *)toDictionary
{
	NSMutableDictionary * dictionary = [NSMutableDictionary dictionary];
	dictionary[kZcoModelScenariosEnableIsRobot] = @(self.isRobot);
	if(self.scenarios != nil){
		NSMutableArray * dictionaryElements = [NSMutableArray array];
		for(ZcoModelScenarioBrief * scenariosElement in self.scenarios){
			[dictionaryElements addObject:[scenariosElement toDictionary]];
		}
		dictionary[kZcoModelScenariosEnableScenarios] = dictionaryElements;
	}
	return dictionary;

}

/**
 * Implementation of NSCoding encoding method
 */
/**
 * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property
 */
- (void)encodeWithCoder:(NSCoder *)aCoder
{
	[aCoder encodeObject:@(self.isRobot) forKey:kZcoModelScenariosEnableIsRobot];	if(self.scenarios != nil){
		[aCoder encodeObject:self.scenarios forKey:kZcoModelScenariosEnableScenarios];
	}

}

/**
 * Implementation of NSCoding initWithCoder: method
 */
- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
	self = [super init];
	self.isRobot = [[aDecoder decodeObjectForKey:kZcoModelScenariosEnableIsRobot] integerValue];
	self.scenarios = [aDecoder decodeObjectForKey:kZcoModelScenariosEnableScenarios];
	return self;

}

/**
 * Implementation of NSCopying copyWithZone: method
 */
- (instancetype)copyWithZone:(NSZone *)zone
{
	ZcoModelScenariosEnable *copy = [ZcoModelScenariosEnable new];

	copy.isRobot = self.isRobot;
	copy.scenarios = [self.scenarios copy];

	return copy;
}
@end
